package com.lswms.modules.lswms.dao.orders;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.lswms.common.dao.BaseDao;
import com.lswms.modules.lswms.entity.orders.OrderdetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 出库明细
 *
 * @author DX sunlightcs@gmail.com
 * @since 1.0.0 2021-06-24
 */
@Mapper
public interface OrderdetailDao extends BaseDao<OrderdetailEntity> {

	@Select(value ="select lswms_orderdetail.* , c.listname  statusstr  , lswms_sku.descr  , lswms_sku.factorycdoe , d.listname  rolatebystr , lswms_allocationstrategy.strategyname "
			+ "	from lswms_orderdetail left join lswms_codelist c on lswms_orderdetail.status = c.list and c.code='OrderStatus' "
			+ "			left join lswms_sku on lswms_orderdetail.sku = lswms_sku.sku  "
			+ "			left join lswms_codelist d  on lswms_orderdetail.rolateby = d.list and d.code='rolateby' "
			+ "			left join lswms_allocationstrategy on lswms_orderdetail.allocationstrategy = lswms_allocationstrategy.strategykey  ${ew.customSqlSegment}")
	IPage<OrderdetailEntity> selectPageBySql(IPage<OrderdetailEntity> page, @Param(Constants.WRAPPER)QueryWrapper<OrderdetailEntity> wrapper);
//	@Select("<script>"
//            +"select * from mi_taobao where 1=1"
//            +"<if test='status != null'>"
//            +"and status = #{status}"
//            +"</if>"
//            +"</script>")
//
//	Integer getReceiptdetailMaxLine(@Param("orderkey")String orderkey);
	
}